
Create  PROC sp_save_tsmc_shipping_info (

	@INVOICE_NO			VARCHAR (50),
	@INVOICE_DATE			VARCHAR (25),
	@CUSTOMER_PO			VARCHAR (50),
	@CUSTOMER_PRODUCT		VARCHAR (50),
	@TSMC_PRODUCT			VARCHAR (50),
	@UM				VARCHAR (10),
	@CUSTOMER_LOT_ID		VARCHAR (50),
	@TSMC_LOT_ID			VARCHAR (50),
	@SHIP_QTY			VARCHAR (10),
	@COMMENT			VARCHAR (50), 
	@WAFER_QTY			VARCHAR (10),
	@DIE_QTY			VARCHAR (10),
	@SHIP_TO       			VARCHAR (50),
	@WAFER_ID			VARCHAR (100),
	@CURRENT_DATE			VARCHAR (10) )

	AS
	BEGIN

		DECLARE @DATE_TIME DATETIME 
     		DECLARE @START_DATE DATETIME 
     		DECLARE @END_DATE DATETIME 
		DECLARE @TIME_STAMP DATETIME 
     		DECLARE @TEMP_VARCHAR VARCHAR(20)
		
		INSERT INTO TSMC_SHIP_TABLE(INVOICE_DATE,INVOICE_NUMBER, CUSTOMER_PO, CUSTOMER_PRODUCT, TSMC_PRODUCT, UM,
			        CUSTOMER_LOTID, TSMC_LOTID, SHIP_QTY,COMMENT, WAFER_QTY, DIE_QTY, SHIP_TO, WAFER_ID, TIMESTAMP)		
				VALUES( @INVOICE_NO, @INVOICE_DATE, @CUSTOMER_PO, @CUSTOMER_PRODUCT, @TSMC_PRODUCT, @UM, @CUSTOMER_LOT_ID,
				@TSMC_LOT_ID, @SHIP_QTY, @COMMENT, @WAFER_QTY, @DIE_QTY, @SHIP_TO, @WAFER_ID, CURRENT_TIMESTAMP)		


		INSERT INTO TSMC_SHIP_HISTORY_TABLE(INVOICE_DATE,INVOICE_NUMBER, CUSTOMER_PO, CUSTOMER_PRODUCT, TSMC_PRODUCT, UM,
			        CUSTOMER_LOTID, TSMC_LOTID, SHIP_QTY,COMMENT, WAFER_QTY, DIE_QTY, SHIP_TO, WAFER_ID, ADAPTOR_DATE, TIMESTAMP)		
				VALUES( @INVOICE_NO, @INVOICE_DATE, @CUSTOMER_PO, @CUSTOMER_PRODUCT, @TSMC_PRODUCT, @UM, @CUSTOMER_LOT_ID,
				@TSMC_LOT_ID, @SHIP_QTY, @COMMENT, @WAFER_QTY, @DIE_QTY, @SHIP_TO, @WAFER_ID, @CURRENT_DATE, CURRENT_TIMESTAMP)		
	END


